﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Tools
{
    public static class PermissionCheck
    {
        public static bool HasPermission(List<string> Permissions, string Permission)
        {
            if (Permission == "")
                return true;
            if (HttpContext.Current.Session["AsynchronousUserID"].ToString() == "Administrator")
                return true;     
            string[] Ps = Permission.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string s in Ps)
                if (Permissions.Contains(s.Trim()))
                    return true;
            return false;
        }             
    }
}
